package com.learn.algorithm.designpattern.chain;

/**
 * 权限判定
 * @author wangxing
 * @version 2020/7/22 13:32 Administrator
 */
public class RuleChain extends BaseChain {
    public RuleChain(BaseChain next) {
        super(next);
    }

    /**
     * 责任实现方法
     *
     * @param request
     * @return
     */
    @Override
    public boolean process(RequestTemp request) {
        System.out.println("进行责任链权限判定------");
        if(request.getRole().equals("100")){
            if(this.getNext() == null){
                return true;
            }else{
                return this.getNext().process(request);
            }
        }
        System.out.println("权限判定失败");
        return false;
    }
}
